<script setup>
import { downloadFiles } from '@T2/utils/utils.ts';

const { config } = defineProps({
  config: {
    type: Object,
    required: true,
  }
});

const downloadFile = (file) => {
  downloadFiles(file.name, file.url);
}
</script>

<template>
  <div class="box flex-column">
    <div class="file-item flex--center" v-for="item in config.value">
      <div class="file">{{ item.name }}</div>
      <el-button link type="primary" size="small" @click="downloadFile(item)">下载</el-button>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.box {
  width: 100%;
  gap: 8px;
  .file-item {
    font-size: 14px;
  }
  .file {
    margin-right: 20px;
  }
}
</style>